/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年10月24日
 */
package com.massyframework.beanskin.service.script;

import java.io.IOException;
import java.util.Map;

import javax.script.ScriptEngine;
import javax.script.ScriptException;

/**
 * 脚本引擎构建器
 * @author huangkh
 *
 */
public interface ScriptEngineBuilder {
		
	/**
	 * 添加脚本对象
	 * @param name {@link String},对象在脚本中的名称
	 * @param value {@link Object},对象实例
	 * @return {@link ScriptEngineBuilder}
	 */
	ScriptEngineBuilder addObject(String name, Object value);
	
	/**
	 * 添加脚本对象集
	 * @param value {@link Map}, 一组名称键值对的对象集合
	 * @return {@link ScriptEngineBuilder}
	 */
	ScriptEngineBuilder addObjects(Map<String, Object> value);
	
	/**
	 * 添加要加载的脚本路径
	 * @param value {@link ScriptFile}
	 * @return {@link ScriptEngineBuilder}
	 */
	ScriptEngineBuilder addScriptFile(ScriptFile value);
		
	/**
	 * 创建脚本引擎实例
	 * @return {@link ScriptEngine}
	 * @throws ScriptEngineNotFoundException 未找到对应脚本引擎所抛出例外
	 * @throws ScriptException 加载脚本文件时抛出的例外
	 * @throws IOException 脚本文件读取时发生的例外
	 */
	ScriptEngine build() throws ScriptEngineNotFoundException, ScriptException, IOException;
}
